package com.mebs.model.service;

import com.mebs.model.*;

import javax.persistence.*;

import static org.hibernate.proxy.HibernateProxyHelper.getClassWithoutInitializingProxy;

/**
 * Created by Sergey Prasolov, sap@jensentechnologies.com
 * Date: Feb 20, 2006, 2:32:50 PM
 */
@MappedSuperclass
public abstract class Service extends Requirement {
    @Column(name = "MebsNotes", nullable = true, length = 1024)
    private String mebsNotes;

    @Column(name = "ClientNotes", nullable = true, length = 1024)
    private String clientNotes;

    public Service()
    {
    }

    /**
     * **********************
     * Getters-setters
     * ***********************
     */
    public String getMebsNotes()
    {
        return mebsNotes;
    }

    public void setMebsNotes(String mebsNotes)
    {
        this.mebsNotes = mebsNotes;
    }

    public String getClientNotes()
    {
        return clientNotes;
    }

    public void setClientNotes(String clientNotes)
    {
        this.clientNotes = clientNotes;
    }

    @Override
    public int hashCode()
    {
        if (getId() == null) return super.hashCode();
        return getId().hashCode();
    }

    @Override
    public boolean equals(Object o)
    {
        if (o == null) return false;
        if (this == o) return true;
        if (getId() == null) return false;
        if (getClassWithoutInitializingProxy(o) != getClassWithoutInitializingProxy(this) &&
            ! getClassWithoutInitializingProxy(o).isAssignableFrom(Service.class))
            return false;
        final Service that = (Service) o;
        return getId().equals(that.getId());
    }
}
